package com.gosophia.roleManagement.action;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

import com.gosophia.commons.OrderCondition;
import com.gosophia.commons.Page;
import com.gosophia.commons.PropertyFilter;
import com.gosophia.commons.web.action.BaseAjaxAction;
import com.gosophia.commons.web.action.BaseSupportAction;
import com.gosophia.commons.web.bean.RequestResult;
import com.gosophia.userManagement.dto.RoleDTO;
import com.gosophia.userManagement.ws.UserManagementWebService;
import com.opensymphony.xwork2.ActionSupport;

@Scope("prototype")
@Controller("GetSameRoleNameAction")
public class GetSameRoleNameAction extends BaseSupportAction{

	
	private RoleDTO role;
	
	private boolean sameName = true;
	
	@Autowired
	private UserManagementWebService userManagementWebService;

	@Override
	public String _execute() throws Exception {
		RoleDTO role0 = userManagementWebService.findRoleByRoleName(role.getRoleName(), role.getRoleId());
		super.getRequestResult().setRsltCode("0");
		if(role0 == null){
			sameName = false;
		}
		return SUCCESS;
	}

	public void setRole(RoleDTO role) {
		this.role = role;
	}

	public RoleDTO getRole() {
		return role;
	}

	public void setSameName(boolean sameName) {
		this.sameName = sameName;
	}

	public boolean getSameName() {
		return sameName;
	}	
}
